import request from '@/utils/request'

// 获取订单列表
export function pageProjectOrder(query) {
  return request({
    url: '/goods/projectOrder/pagingProjectOrder',
    method: 'get',
    params: query
  })
}
// 店主分销订单 分页查询
export function pagingMemberProjectOrder(query) {
  return request({
    url: '/goods/projectOrder/pagingMemberProjectOrder',
    method: 'get',
    params: query
  })
}
// 顾客所属店主订单 分页查询
export function pagingMemberAllProjectOrder(query) {
  return request({
    url: '/goods/projectOrder/pagingMemberAllProjectOrder',
    method: 'get',
    params: query

  })
}
// 店主分销订单 统计
export function countMemberProjectOrder(query) {
  return request({
    url: '/goods/projectOrder/countMemberProjectOrder',
    method: 'get',
    params: query
  })
}

// 获取订单列表
export function pagingMemberOrder(query) {
  return request({
    url: '/goods/projectOrder/pagingMemberOrder',
    method: 'get',
    params: query
  })
}

// 获取订单商品统计列表
export function pagingProjectOrderGoods(query) {
  return request({
    url: '/goods/projectOrder/pagingProjectOrderGoods',
    method: 'get',
    params: query
  })
}

// 统计订单情况
export function statProjectOrder(query) {
  return request({
    url: '/goods/projectOrder/statProjectOrder',
    method: 'get',
    params: query
  })
}

// 显示最新的n条订单
export function listLastPaidOrder(query) {
  return request({
    url: '/goods/projectOrder/listLastPaidOrder',
    method: 'get',
    params: query
  })
}

// 更新收货信息
export function updateDelivery(order) {
  return request({
    url: '/goods/projectOrder/updateDelivery',
    method: 'post',
    data: order
  })
}

// 根据订单id获取订单信息
export function getOrder(orderId) {
  return request({
    url: '/goods/projectOrder/getOrder',
    method: 'get',
    params: {
      orderId
    }
  })
}

// 打印订单
export function printOrder(params) {
  return request({
    url: '/goods/projectOrder/printOrder',
    method: 'get',
    params: params
  })
}

// 获取扫码支付二维码
export function getPayCode(orderId, payType) {
  return request({
    url: '/goods/projectOrder/getPayCode',
    method: 'get',
    params: {
      orderId,
      payType
    }
  })
}

// 获取扫码支付结果
export function checkPayStatus(orderId) {
  return request({
    url: '/goods/projectOrder/checkPayStatus',
    method: 'get',
    params: {
      orderId
    }
  })
}

// 获取扫码支付二维码
export function getBatPayCode(orderIds, payType) {
  return request({
    url: '/goods/projectOrder/getBatPayCode',
    method: 'get',
    params: {
      orderIds,
      payType
    }
  })
}

// 获取扫码支付结果
export function checkBatPayStatus(batPayId) {
  return request({
    url: '/goods/projectOrder/checkBatPayStatus',
    method: 'get',
    params: {
      batPayId
    }
  })
}

// 取消订单
export function doCancelOrder(data) {
  return request({
    url: '/goods/projectOrder/doCancelOrder',
    method: 'post',
    data: data
  })
}

// 换货下单
export function doChangeOrder(data) {
  return request({
    url: '/goods/projectOrder/doChangeOrder',
    method: 'post',
    data: data
  })
}

// 统计门店全部订单信息
export function getStatisticsStoreOrderInfo(query) {
  return request({
    url: '/goods/projectOrder/statisticsStoreOrderInfo',
    method: 'get',
    params: query
  })
}

// 获取授信订单列表
export function pagingCreditPayOrder(query) {
  return request({
    url: '/goods/projectOrder/pagingCreditPayOrder',
    method: 'get',
    params: query
  })
}

// 统计授信订单情况
export function statCreditPayOrder(query) {
  return request({
    url: '/goods/projectOrder/statCreditPayOrder',
    method: 'get',
    params: query
  })
}

// 统计订单商品报表
export function pagingGetOrderReport(query) {
  return request({
    url: '/order/projectOrderGoods/pagingGetOrderReport',
    method: 'get',
    params: query
  })
}
// 统计订单商品报表
export function pagingGetOrderGoodsReport(query) {
  return request({
    url: '/order/projectOrderGoods/pagingGetOrderGoodsReport',
    method: 'get',
    params: query
  })
}
// 导出统计订单报表
export function exportPagingGetOrderReport(data) {
  return request({
    url: '/order/projectOrderGoods/exportPagingGetOrderReport',
    method: 'post',
    data: data
  })
}
// 导出统计订单商品报表
export function exportPagingGetOrderGoodsReport(data) {
  return request({
    url: '/order/projectOrderGoods/exportPagingGetOrderGoodsReport',
    method: 'post',
    data: data
  })
}
/**
 * 按订单支付时间区间生成社区团购配送单
 * @param {Object} params
 */
export function generateGroupBuyDelivery(params) {
  return request({
    url: '/goods/projectOrder/generateGroupBuyDelivery',
    method: 'get',
    params: params
  })
}
/**
 * 是否存在手动正在生成的社区团购配送单任务
 * @param {Object} params
 */
export function isExistGenerateGroupBuyDeliveryTask(params) {
  return request({
    url: '/goods/projectOrder/isExistGenerateGroupBuyDeliveryTask',
    method: 'get',
    params: params
  })
}

// 更新订单打印状态
export function updateOrderPrintType(params) {
  return request({
    url: '/goods/projectOrder/updateOrderPrintType',
    method: 'get',
    params: params
  })
}

// 获取开发票的订单列表
export function pagingGetOpenInvoiceProjectOrderList(params) {
  return request({
    url: '/goods/projectOrder/pagingGetOpenInvoiceProjectOrderList',
    method: 'get',
    params: params
  })
}
// 获取主订单信息
export function getOrderInfo(params) {
  return request({
    url: '/goods/projectOrder/getOrderInfo',
    method: 'get',
    params: params
  })
}

// 修改购买人信息
export function doUpdateCerrificateInfo(data) {
  return request({
    url: '/goods/projectOrder/updateCertificateInfo',
    method: 'post',
    data: data
  })
}
